package chaoyue.study.listener;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MyConsumer2 {

    /**
     * 声明监听者同时完成队列绑定
     */
    @RabbitListener(bindings = {
            @QueueBinding(
                    exchange = @Exchange("exchange2"),
                    value = @Queue("queue2"),
                    key = "key2")
    })
    public void receiveOtherMessage(String message) {
        System.out.println("queue2 接收到消息：" + message);
    }
}
